/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package SessionBeans;

import Classes.*;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Tomas
 */
@Stateless
public class ProjectUserFacade implements ProjectUserFacadeLocal {
    @PersistenceContext
    private EntityManager em;

    public void create(ProjectUser projectUser) {
        em.persist(projectUser);
    }

    public void edit(ProjectUser projectUser) {
        em.merge(projectUser);
    }

    public void remove(ProjectUser projectUser) {
        em.remove(em.merge(projectUser));
    }

    public ProjectUser find(Object id) {
        return em.find(Classes.ProjectUser.class, id);
    }

    public List<ProjectUser> findAll() {
        return em.createQuery("select object(o) from ProjectUser as o").getResultList();
    }

}
